package io.p2p.stream.p2pmain;

import io.p2p.stream.p2pmain.model.MainSharedModel;
import io.p2p.stream.p2pmain.service.MainUdpServer;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.util.Scanner;

@Slf4j
public class MainServiceStarter {

    public static void main(String[] args) throws IOException {

        MainUdpServer firstUdpServer = new MainUdpServer();
        firstUdpServer.start(MainSharedModel.mainServerFirstIP,MainSharedModel.mainServerFirstPort);

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入内容，输入 'exit' 退出：");

        // 无限循环，等待用户输入
        while (true) {
            String input = scanner.nextLine();

            // 如果用户输入了 "exit"，则退出循环
            if (input.equalsIgnoreCase("exit")) {
                break;
            }

            // 处理用户输入
            System.out.println("用户输入为: " + input);
        }

        // 关闭 Scanner
        scanner.close();
        System.out.println("程序退出。");
    }
}